<template>
	<view class="header">
		<view class="back-btn" @click="goBack">
			<text class="back-icon">返回</text>
		</view>
		<text class="title">{{title}}</text>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		props: {
			title: String,

		},
		methods:{
			// 返回上一页
			goBack() {
				uni.navigateBack({
					delta: 1 // 返回的层级，通常为 1 即返回上一页
				});
				return 
			}
		}
	}
</script>

<style>
	.header {
		position: fixed;
		top:0;
		left: 0;
		right: 0;
		height: 50px;
		background-color: #f5f5f5;
		display: flex;
		align-items: center;
		padding: 0 10px;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	}

	.back-btn {
		display: flex;
		align-items: center;
		padding-right: 10px;
		cursor: pointer;
	}

	.back-icon {
		font-size: 18px;
	}

	.title {
		flex: 1;
		text-align: center;
		font-size: 16px;
		font-weight: bold;
	}
</style>